home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / src / faces.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-14  |  7.0 KB  |  187 lines

  1. /* Face data structures.
  2.    Copyright (C) 1995 Board of Trustees, University of Illinois
  3.    Copyright (C) 1995 Ben Wing
  4.  
  5. This file is part of XEmacs.
  6.  
  7. XEmacs is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. XEmacs is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with XEmacs; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /* Synched up with: Not in FSF. */
  22.  
  23. #ifndef _XEMACS_FACES_H_
  24. #define _XEMACS_FACES_H_
  25.  
  26. #include "dynarr.h"
  27.  
  28. struct Lisp_Face
  29. {
  30.   struct lcrecord_header header;
  31.  
  32.   Lisp_Object name;
  33.   Lisp_Object doc_string;
  34.   unsigned int dirty :1;
  35.  
  36.   Lisp_Object foreground;
  37.   Lisp_Object background;
  38.   Lisp_Object font;
  39.  
  40.   Lisp_Object display_table;
  41.   Lisp_Object background_pixmap;
  42.  
  43.   Lisp_Object underline;
  44.   Lisp_Object highlight;
  45.   Lisp_Object dim;
  46.   Lisp_Object blinking;
  47.   Lisp_Object reverse;
  48.  
  49.   Lisp_Object plist;
  50. };
  51.  
  52. struct face_cache_element
  53. {
  54.   Lisp_Object face;
  55.  
  56.   Lisp_Object foreground;
  57.   Lisp_Object background;
  58.   Lisp_Object font;
  59.   Lisp_Object display_table;
  60.   Lisp_Object background_pixmap;
  61.  
  62.   unsigned int dirty :1;
  63.   unsigned int updated :1;
  64.  
  65.   unsigned int underline :1;
  66.   unsigned int highlight :1;
  67.   unsigned int dim :1;
  68.   unsigned int blinking :1;
  69.   unsigned int reverse :1;
  70.  
  71.   /* Used when merging to tell if the above field represents an actual
  72.      value of this face or a fallback value. */
  73.   unsigned int foreground_specified :1;
  74.   unsigned int background_specified :1;
  75.   unsigned int font_specified :1;
  76.   unsigned int display_table_specified :1;
  77.   unsigned int background_pixmap_specified :1;
  78.  
  79.   unsigned int underline_specified :1;
  80.   unsigned int highlight_specified :1;
  81.   unsigned int dim_specified :1;
  82.   unsigned int blinking_specified :1;
  83.   unsigned int reverse_specified :1;
  84. };
  85.  
  86. DECLARE_LRECORD (face, struct Lisp_Face);
  87. #define XFACE(x) XRECORD (x, face, struct Lisp_Face)
  88. #define XSETFACE(x, p) XSETRECORD (x, p, face)
  89. #define FACEP(x) RECORDP (x, face)
  90. #define CHECK_FACE(x, i) CHECK_RECORD (x, face)
  91.  
  92. extern void mark_face_cache_elements (face_cache_element_dynarr *elements,
  93.                       void (*markobj) (Lisp_Object));
  94. extern void mark_face_cache_elements_as_clean (struct window *w);
  95. extern void mark_face_cache_elements_as_not_updated (struct window *w);
  96. extern void reset_face_cache_elements (struct window *w);
  97. extern face_index get_builtin_face_cache_index (struct window *w,
  98.                         Lisp_Object face);
  99.  
  100. extern void mark_all_faces_as_clean (void);
  101. extern void init_frame_faces (struct frame *f);
  102. extern void init_device_faces (struct device *d);
  103. extern void init_global_faces (struct device *d);
  104. extern face_index
  105. get_extent_fragment_face_cache_index (struct window *w,
  106.                       struct extent_fragment *ef,
  107.                       struct extent *dummy_lhe_extent);
  108. extern Lisp_Object Ffind_face (Lisp_Object face_or_name);
  109. extern Lisp_Object Fget_face (Lisp_Object face_or_name);
  110. extern void update_frame_face_values (struct frame *f);
  111. extern void face_property_was_changed (Lisp_Object face, Lisp_Object property,
  112.                        Lisp_Object locale);
  113. extern void face_font_metric_info (Lisp_Object face, Lisp_Object domain,
  114.                    struct font_metric_info *fm);
  115. extern void default_face_height_and_width (Lisp_Object domain,
  116.                            int *height, int *width);
  117.  
  118. extern Lisp_Object Qforeground, Qbackground, Qfont, Qdisplay_table;
  119. extern Lisp_Object Qbackground_pixmap, Qunderline, Qhighlight, Qdim;
  120. extern Lisp_Object Qblinking, Qreverse;
  121.  
  122. extern Lisp_Object Vdefault_face, Vmodeline_face, Vhighlight_face;
  123. extern Lisp_Object Vleft_margin_face, Vright_margin_face;
  124.  
  125. #define FACE_CACHE_ELEMENT_FACE(window, index)                \
  126.   Dynarr_atp (window->face_cache_elements, index)->face
  127. #define FACE_CACHE_ELEMENT_FOREGROUND(window, index)            \
  128.   Dynarr_atp (window->face_cache_elements, index)->foreground
  129. #define FACE_CACHE_ELEMENT_BACKGROUND(window, index)            \
  130.   Dynarr_atp (window->face_cache_elements, index)->background
  131. /* #### This can be referenced by the font_metric_info device method,
  132.    but face_cache_elements isn't initialized for the stream device.
  133.    Since it doesn't need the value we just return nil here to avoid
  134.    blowing up in multiple places. */
  135. #define FACE_CACHE_ELEMENT_FONT(window, index)                \
  136.   ((window)->face_cache_elements                    \
  137.    ? Dynarr_atp (window->face_cache_elements, index)->font        \
  138.    : Qnil)
  139. #define FACE_CACHE_ELEMENT_DISPLAY_TABLE(window, index)            \
  140.   Dynarr_atp (window->face_cache_elements, index)->display_table
  141. #define FACE_CACHE_ELEMENT_BACKGROUND_PIXMAP(window, index)        \
  142.   Dynarr_atp (window->face_cache_elements, index)->background_pixmap
  143. #define FACE_CACHE_ELEMENT_DIRTY(window, index)                \
  144.   Dynarr_atp (window->face_cache_elements, index)->dirty
  145. #define FACE_CACHE_ELEMENT_UNDERLINE_P(window, index)            \
  146.   Dynarr_atp (window->face_cache_elements, index)->underline
  147. #define FACE_CACHE_ELEMENT_HIGHLIGHT_P(window, index)            \
  148.   Dynarr_atp (window->face_cache_elements, index)->highlight
  149. #define FACE_CACHE_ELEMENT_DIM_P(window, index)                \
  150.   Dynarr_atp (window->face_cache_elements, index)->dim
  151. #define FACE_CACHE_ELEMENT_BLINKING_P(window, index)            \
  152.   Dynarr_atp (window->face_cache_elements, index)->blinking
  153. #define FACE_CACHE_ELEMENT_REVERSE_P(window, index)            \
  154.   Dynarr_atp (window->face_cache_elements, index)->reverse
  155.  
  156. #define FACE_PROPERTY_INSTANCE(face, property, domain, no_fallback)    \
  157.   specifier_instance_no_quit (Fget (face, property, Qnil), domain,    \
  158.                   no_fallback)
  159. #define FACE_PROPERTY_SPEC_LIST(face, property, locale)            \
  160.   Fspecifier_spec_list (Fget (face, property, Qnil), locale, Qnil, Qnil)
  161. #define SET_FACE_PROPERTY(face, property, locale, value, tag, how_to_add) \
  162.   Fadd_spec_to_specifier (Fget (face, property, Qnil),              \
  163.               locale, value, tag, how_to_add)
  164.  
  165. #define FACE_FOREGROUND(face, domain)                    \
  166.   FACE_PROPERTY_INSTANCE (face, Qforeground, domain, 0)
  167. #define FACE_BACKGROUND(face, domain)                    \
  168.   FACE_PROPERTY_INSTANCE (face, Qbackground, domain, 0)
  169. #define FACE_FONT(face, domain)                        \
  170.   FACE_PROPERTY_INSTANCE (face, Qfont, domain, 0)
  171. #define FACE_DISPLAY_TABLE(face, domain)                \
  172.   FACE_PROPERTY_INSTANCE (face, Qdisplay_table, domain, 0)
  173. #define FACE_BACKGROUND_PIXMAP(face, domain)                \
  174.   FACE_PROPERTY_INSTANCE (face, Qbackground_pixmap, domain, 0)
  175. #define FACE_UNDERLINE_P(face, domain)                    \
  176.   FACE_PROPERTY_INSTANCE (face, Qunderline_p, domain, 0)
  177. #define FACE_HIGHLIGHT_P(face, domain)                    \
  178.   FACE_PROPERTY_INSTANCE (face, Qhighlight_p, domain, 0)
  179. #define FACE_DIM_P(face, domain)                    \
  180.   FACE_PROPERTY_INSTANCE (face, Qdim_p, domain, 0)
  181. #define FACE_BLINKING_P(face, domain)                    \
  182.   FACE_PROPERTY_INSTANCE (face, Qblinking_p, domain, 0)
  183. #define FACE_REVERSE_P(face, domain)                    \
  184.   FACE_PROPERTY_INSTANCE (face, Qreverse_p, domain, 0)
  185.  
  186. #endif /* _XEMACS_FACES_H_ */
  187.